package com.ruoyi.workSafetyStandardization.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.workSafetyStandardization.mapper.GradeRuleMapper;
import com.ruoyi.workSafetyStandardization.domain.GradeRule;
import com.ruoyi.workSafetyStandardization.service.IGradeRuleService;

/**
 * 评分-评级得分规则Service业务层处理
 *
 * @author pengjie
 * @date 2023-12-15
 */
@Service
public class GradeRuleServiceImpl implements IGradeRuleService
{
    @Autowired
    private GradeRuleMapper gradeRuleMapper;

    /**
     * 查询评分-评级得分规则
     *
     * @param gradeRuleId 评分-评级得分规则主键
     * @return 评分-评级得分规则
     */
    @Override
    public GradeRule selectGradeRuleByGradeRuleId(String gradeRuleId)
    {
        return gradeRuleMapper.selectGradeRuleByGradeRuleId(gradeRuleId);
    }

    /**
     * 查询评分-评级得分规则列表
     *
     * @param gradeRule 评分-评级得分规则
     * @return 评分-评级得分规则
     */
    @Override
    public List<GradeRule> selectGradeRuleList(GradeRule gradeRule)
    {
        return gradeRuleMapper.selectGradeRuleList(gradeRule);
    }

    /**
     * 新增评分-评级得分规则
     *
     * @param gradeRule 评分-评级得分规则
     * @return 结果
     */
    @Override
    public int insertGradeRule(GradeRule gradeRule)
    {
        gradeRule.setCreateByName(SecurityUtils.getUsername());
        gradeRule.setCreateAt(new Date());
        gradeRule.setCreateBy(SecurityUtils.getUserId().toString());
        return gradeRuleMapper.insertGradeRule(gradeRule);
    }

    /**
     * 修改评分-评级得分规则
     *
     * @param gradeRule 评分-评级得分规则
     * @return 结果
     */
    @Override
    public int updateGradeRule(GradeRule gradeRule)
    {
        return gradeRuleMapper.updateGradeRule(gradeRule);
    }

    /**
     * 批量删除评分-评级得分规则
     *
     * @param gradeRuleIds 需要删除的评分-评级得分规则主键
     * @return 结果
     */
    @Override
    public int deleteGradeRuleByGradeRuleIds(String[] gradeRuleIds)
    {
        return gradeRuleMapper.deleteGradeRuleByGradeRuleIds(gradeRuleIds);
    }

    /**
     * 删除评分-评级得分规则信息
     *
     * @param gradeRuleId 评分-评级得分规则主键
     * @return 结果
     */
    @Override
    public int deleteGradeRuleByGradeRuleId(String gradeRuleId)
    {
        return gradeRuleMapper.deleteGradeRuleByGradeRuleId(gradeRuleId);
    }
}
